class myClass
{
public:
	void foo();
private:
	int _a = 0;
	int _b = 1;
};

void myClass::foo() 
{
	delete this;
}
void func() {
	myClass* a = new myClass();
	a->foo();
}

int main()
{
	func();

	return 0;
}